package com.app.utiles.sound;

import com.app.utiles.other.FileUtile;

import java.io.File;
import java.util.ArrayList;

public class VoiceUtile {
	public static String ulrTest = "http://117.21.168.25/ws.cdn.baidupcs.com/file/a35b18a774e3ff58fc5d1d5d2f4c6f15?bkt=p2-qd-568&xcode=09ce7c753913a973ed65eaa8c157c50594d21ffe4fe7344aed03e924080ece4b&fid=625766978-250528-193871658693036&time=1438828445&sign=FDTAXERLBH-DCb740ccc5511e5e8fedcff06b081203-WYAzGSfHoqSBiitZzlZTCpLDOdw%3D&to=hc&fm=Nan,B,T,t&sta_dx=4&sta_cs=257&sta_ft=mp3&sta_ct=6&fm2=Nanjing,B,T,t&newver=1&newfm=1&secfm=1&flow_ver=3&sl=75038799&expires=8h&rt=sh&r=257036213&mlogid=2904059799&vuk=1614256777&vbdid=770797351&fin=999%E6%9C%B5%E7%8E%AB%E7%91%B0.mp3&fn=999%E6%9C%B5%E7%8E%AB%E7%91%B0.mp3&slt=pm&uta=0&rtype=1&iv=0&isw=0&wshc_tag=0&wsts_tag=55c2c79d&wsid_tag=7d767eb1&wsiphost=ipdbm";
	public static ArrayList<String> path = new ArrayList<String>();

	/** 下载语音 */
	public static void voiceDownload(final String url) {
		String filename = FileUtile.getVoiceCacheFileName(url);
		File file = new File(filename);
		if (file.exists()) {
			return;
		}
		if (path.contains(url)) {
			return;
		}
		/*VoiceThreadPool.getInstance().execute(new PriorityRunnable() {
			@Override
			public voide run() {
				HttpUtil.get(url, new InputStreamParser<String>() {

					@Override
					public String parser(InputStream inputStream) {
						try {
							FileUtil.writeVoice(inputStream, url);
						} catch (Exception e) {
							e.getMessage();
						} finally {
							path.remove(url);
						}
						return null;
					}
				});
			}
		});*/
	}
}
